const express = require("express")
const app = express()
const Coupon = require('../service/user/coupon')



app.get("/coupon",async(req,res)=>{
    console.log(req.query)
    let result = await Coupon.getUserCouponId(req.query.userId)
    console.log(result);
    res.send(result)
})


app.get("/couponList",async(req,res)=>{
    console.log(JSON.parse(req.query.couponId))

    let result = await Coupon.getUserCoupon(JSON.parse(req.query.couponId))
    // console.log(result);
    res.send(result)
})


app.delete("/userCoupon",async(req,res)=>{

    let result = await Coupon.DeleteUserCoupon(req.query.userId,req.query.couponId)
    // console.log(result);
    res.send(result)
})

app.get("/userCoupon",async(req,res)=>{

    let result = await Coupon.addUserCoupon(req.query.userId,req.query.couponId)
    // console.log(result);
    res.send(result)
})


module.exports = app;
